def spiral_matrix(n, m, r, c):
    Map = [[0] * m for _ in range(n)]
    x, y = 0, 0
    value = 1
    # 已经写入第一个元素
    Map[x][y] = value
    while value < n * m:
        # 向右走
        # 保证下一个点不越界且下一个点没有数字
        while y + 1 < m and Map[x][y + 1] == 0:
            y += 1
            value += 1
            Map[x][y] = value

        # 向下走
        while x + 1 < n and Map[x + 1][y] == 0:
            x += 1
            value += 1
            Map[x][y] = value

        # 向左走
        while y - 1 >= 0 and Map[x][y - 1] == 0:
            y -= 1
            value += 1
            Map[x][y] = value

        # 向上走
        while x - 1 >= 0 and Map[x - 1][y] == 0:
            x -= 1
            value += 1
            Map[x][y] = value

    print(Map[r - 1][c - 1])
    return Map


n, m, r, c = map(int, input().split())
ma = spiral_matrix(n, m, r, c)
for i in ma:
    print(" ".join(map(str, i)))
